package TableCreate;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import oracle.jdbc.pool.OracleDataSource;

public class InsertUser {

    public static void main(String[] args) {
        String jdbcUrl = "jdbc:oracle:thin:@172.23.9.185:1521:orcl";
        String userid = "mhs115314034"; // gantikan dengan username anda
        String password = "mhs115314034"; // gantikan dengan password anda
//                String jdbcUrl = "jdbc:oracle:thin:@localhost:1521:xe";
//    String userid = "hr"; // gantikan dengan username anda
//    String password = "hr"; // gantikan dengan password anda

        try {
            Connection connection = null;
            OracleDataSource ds;
            ds = new OracleDataSource();
            ds.setURL(jdbcUrl);
            ds.setPassword(password);
            ds.setUser(userid);
            connection = (Connection) ds.getConnection();
            Statement statement = connection.createStatement();
            statement.executeQuery("insert into usergudangt values ('gudang','gudang','sleman','085085085085','gudang','gudang')");
            statement.executeQuery("insert into usergudangt values ('toko','toko','bantul','087087087087','toko','toko')");
            System.out.println("data berhasil di inputkan");
        } catch (SQLException e) {
// perform error handling here
            System.out.println("error :" + e.getMessage());
        }
    }
}
